(function($,jQuery){
	function color(c,w,h,_pre){
		this.c=c;
		this.ary=[w,h,0,0];
		this.count=0;
		this.block=0;
		this._pre=_pre;
		this.tz={'point':""};
	}
	color.prototype={
		load:function (){
			var el=document.getElementById(this._pre+this.i),w=this.w,h=this.h;
			el.width = w;
			el.height = h;			
			var container=el.getContext("2d");
			container.drawImage(document.getElementById(this._pre),this.ary[0], this.ary[1],w,h,0,0,w,h);
			this.data = gw.getImgData(container,w,h).data;		
			return this;
		},
		getRGB : function (i,j){
			var s = ( i * this.w + j ) * 4 ;
			return ( this.data[0 + s] << 16 ) + ( this.data[1 + s] << 8 ) + this.data[2 + s];
		},
		reBG : function (){
			var p="",i=0,j=0,w=this.w,h=this.h;
			for(i=0;i<h;i++){
				for(j=0;j<w;j++){ 
					if(this.c==this.getRGB(i,j)){
						p+='1';
					}else{
						p+='0';
					}	
				}
			}
			this.tz.point=p;
			return this;
		}
	}
	
	$.yzm=function yzm(s,l,_pre){
		this.box=s;
		this.src=s.src;
		this.w=s.width;
		this.h=s.height;
		this._pre=this._pre||'c';
		this.l=l;
		this.init(s);
	}
	$.yzm.prototype={
		init: function (s){
			var l=this.l,p=$(s).parent(),w=this.w,w1=this.w>>1,h=this.h,i=0,_pre=this._pre;
			p.append($('<canvas>').attr({'id':_pre,'width':this.w,'height':h}));
			for(i=0;i<l;i++){
				p.append($('<canvas>').attr({'id':_pre+i,'width':w1,'height':h}));
			}			
		},
		load: function(){
			var l=this.l,w=this.w,w1=this.w>>1,h=this.h,i=0,_pre=this._pre;
			var container=$('#'+_pre)[0].getContext("2d");
			container.drawImage(this.box,0, 0,w,h);
			this.data = gw.getImgData(container,w,h).data;
			this.d={};
			this.b=[];
			return this;
		},
		getRGB : function (i,j){
			var s = ( i * this.w + j ) * 4 ;
			return ( this.data[0 + s] << 16 ) + ( this.data[1 + s] << 8 ) + this.data[2 + s];
		},
		cut : function(){
			var k=0,l=this.l,y='';
			for(k=0;k<l;k++){
				this.b[k]=new color(13828096,k*10+2,0,this._pre)
				this.b[k].w=6;this.b[k].h=10;
				this.b[k].i=k; 
				try{
					y+=this.get(this.b[k].load().reBG());
				} catch (e) {
					throw "erro";
					return;
				}
			}		
			return y;
		},
		get:function(){
			
		}
	}
})(___jQuery,___jQuery)